package com.sky.service;

import com.sky.dao.ContractMapper;
import com.sky.model.BaseModel;
import com.sky.model.Contract;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * @author zhijun.guo
 * @create 2019-03-23 23:33
 **/
@Service
public class ContractService {

    @Autowired
    ContractMapper ContractMapper;

    public List<BaseModel> query(Contract Contract) {
        return ContractMapper.query(Contract);
    }

    public int insert(Contract record) {
        record.setId(UUID.randomUUID().toString());
        return ContractMapper.insertSelective(record);
    }

    public BaseModel selectById(String id) {
        return this.ContractMapper.selectByPrimaryKey(id);
    }

    public int update(Contract Contract) {
        return this.ContractMapper.updateByPrimaryKey(Contract);
    }

    public int delete(String id) {
        return this.ContractMapper.deleteByPrimaryKey(id);
    }
}
